package IViews;

import java.awt.Color;
import java.awt.Font;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;

public class INormalButton extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1261794877322277768L;
	public final static short GREEN = 0;
	public final static short RED = 1;
	public final static short BLACK = 2;
	public final static short WHITE = 3;

	private final static short maxColors = 4;

	private int myColor = 0;
	private int iWidth = 120;

	public INormalButton(String text, int x, int y, int width, int color) {
		super();
		this.myColor = (color % maxColors);
		this.setLayout(null);

		iWidth = width;

		this.setBounds(x, y, iWidth, 46);
		this.setOpaque(false);
		this.createLabels(text);
	}

	private void createLabels(String text) {

		this.add(new IImageWraper(0, 0, 12, 46, "Button/button_l_" + myColor
				+ ".png"));
		this.add(new IImageWraper(12, 0, iWidth - 24, 46, "Button/button_m_"
				+ myColor + ".png"));
		this.add(new IImageWraper(iWidth - 12, 0, 12, 46, "Button/button_r_"
				+ myColor + ".png"));

		Font f = new Font(Font.SANS_SERIF, Font.PLAIN, 20);
		JLabel t = new JLabel(text);
		t.setFont(f);
		t.setHorizontalAlignment(SwingConstants.CENTER);
		t.setForeground(Color.WHITE);
		t.setBounds(12, 0, iWidth - 24, 46);
		this.add(t, 0);

	}

}
